﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.zkingsoft.com" prefix="matrix"%>
<c:set var="path" value="${pageContext.request.contextPath }" />
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<LINK rel="Bookmark" href="../images/favicon.ico">
<!-- 本框架基本脚本和样式 -->
<script type="text/javascript"
	src="${path }/resource/js/plugin/jquery-2.1.4.min.js"></script>
<script type="text/javascript"
	src="${path }/resource/js/systools/MBase.js"></script>
<!-- 文件上传需要的样式 -->
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/themes/default/default.css" />
<link rel="stylesheet" type="text/css"
	href="${path }/resource/plugin/kindeditor/plugins/code/prettify.css" />
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/kindeditor.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/lang/zh_CN.js"></script>
<script type="text/javascript"
	src="${path }/resource/plugin/kindeditor/plugins/code/prettify.js"></script>
</head>

<div class="ibox-content">
	<form class="form-horizontal" id="dataform"
		onsubmit="javascripr:return false;">
		<input type="hidden" name="tokenUrl" value="${tokenUrl}">	 
		<input type="hidden" name="token" value="${token}">
		<c:if test="${obj ne null }">
			<input type="hidden" name="proId" id="proId" value="${obj.proId}">
			<input type="hidden" id="proCateId" value="${obj.proCateId}">
		</c:if>
		<div class="form-group">
			<label class="col-sm-2 control-label">产品名称<span class="text-danger">*</span></label>
			<div class="col-sm-3">
				<input type="text" class="form-control" name="proName"
					value="<c:out value="${obj.proName}" /> " datatype="*" nullmsg="产品名称不能为空">
			</div>
			<div class="Validform_checktip"></div>
			<label class="col-sm-2 control-label">产品类别</label>
			<div class="col-sm-3">
				<select class="select2 form-control " size="1" name="proCateId" id="parentId">
					<!-- <option value="0" selected="selected">--请选择产品类别--</option> -->
				</select>
			</div>
			<div class="Validform_checktip"></div>
		</div>
		
		<div class="form-group">
			<label class="col-sm-2 control-label">产品描述</label>
			<div class="col-sm-8" >
				<textarea name="proDescription" id="proDescription" >
					${obj.proDescription}
				</textarea>
			</div>
			<div class="Validform_checktip"></div>
		</div>
			
			<div class="form-group">
			<label class="col-sm-2 control-label">图集</label>
			<div class="col-sm-8">
				<div class="row">
					<div class="col-sm-12">
						<table class="table table-bordered">
							<thead>
								<tr>
									<th>序号</th>
									<th>操作</th>
								</tr>
							</thead>
							<tbody>
							<tr>
									<td>主图</td>
									<td><input name="proMainPhoto"
										id="proMainPhoto" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proMainPhoto }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								<tr>
									<td>1</td>
									<td><input name="proPhoto1"
										id="proPhoto1" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto1 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								<tr>
									<td>2</td>
									<td><input name="proPhoto2"
										id="proPhoto2" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto2 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								 <tr>
									<td>3</td>
									<td><input name="proPhoto3"
										id="proPhoto3" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto3 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								 <tr>
									<td>4</td>
									<td><input name="proPhoto4"
										id="proPhoto4" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto4 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								 <tr>
									<td>5</td>
									<td><input name="proPhoto5"
										id="proPhoto5" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto5 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								 <tr>
									<td>5</td>
									<td><input name="proPhoto6"
										id="proPhoto6" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto6 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								 <tr>
									<td>5</td>
									<td><input name="proPhoto7"
										id="proPhoto7" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto7 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								 <tr>
									<td>5</td>
									<td><input name="proPhoto8"
										id="proPhoto8" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto8 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
								 <tr>
									<td>9</td>
									<td><input name="proPhoto9"
										id="proPhoto9" class="input-text upload-url radius form-control inp"
										type="text" value="${obj.proPhoto9 }" readonly style="width: 80%;display: inline;" /> 
										<a class="btn btn-primary radius upload-a">
											<i class="fa fa-cloud-upload"></i> 上传图片</a>
									</td>
								 </tr>
							</tbody>
						</table>
			
			
		<div class="form-group ">
			<div class="col-sm-12 text-center">
				<a href="javascript:;" onclick="myForm.submit()"
					class="btn btn-success radius"><i class="fa fa-check"></i>保存</a>&nbsp;&nbsp;&nbsp;&nbsp; 
				<button type="button" class="btn btn-danger radius" onclick="MTools.closeForm()"><i class="fa fa-close"></i>取消</button>
			</div>
		</div>
		
	</form>

</div>

</body>
	<script type="text/javascript"
	src="${path }/resource/js/systools/MJsBase.js"></script>
	<script type="text/javascript">
		var editor = null;
		var myForm=MForm.initForm({
			invokeUrl:"${path}/admin/webProduct/addOrModify",
			beforeSubmit:function(){
				editor.sync();
			},
			afterSubmit:function(){
				parent.myGrid.serchData();
			},
		});
		
		$(function() {		
			MUI.initImgUpload(".inp");
			$(".select2").select2({'width':'100%'});
			MUI.createEdit("proDescription", '100%', '200px', 'editor');
			initFunctionList();
		});
		
		/**
		 * 初始产品分类列表
		 */
		function initFunctionList() {
			$.AjaxProxy().invoke("${path}/admin/webProductCategory/all",
					function(loj) {
						$("#parentId").createSelectTree(
							loj.attr("result").rows,
							{	id : "prcId",		// 选项的值
								parent : "prcParentId",	// 父节点值
								value : "prcName",	// 要显示的名称
								append : false,
								defaultValue : $("#proCateId").val(),
								defaultHtml : '<option value="0" selected="selected">请选择产品类别</option>'
							});
					});	
		}
		
		
		function autoZy() {
			var text = editor.text();
			$("#zy-input").val(text.substring(0, 100));
		}
		function cleanZy() {
			$("#zy-input").val("");
		}
		//上传图片回调函数
		 function uploadCallBack1(id,path){
			 $("#"+id).next().val(path);		
			$("#"+id).next().next().attr("src" ,path);
		}
	</script>
</html>